﻿using IOA.MES.Client.Common;
using System.Windows;

namespace IOA.MES.Client.NameplatePrinting
{
    /// <summary>
    /// WinDeviceSettings.xaml 的交互逻辑
    /// </summary>
    public partial class WinDeviceSettings : Window
    {
        public WinDeviceSettings()
        {
            InitializeComponent();
            txtIpAddress.Text = BaseEnv.GetStorage("DeviceIpAddress") ?? string.Empty;
            txtPort.Text = BaseEnv.GetStorage("DevicePort") ?? string.Empty;
        }

        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            var ipAddress = txtIpAddress.Text.Trim();
            var port = txtPort.Text.Trim();

            BaseEnv.SetStorage("DeviceIpAddress", ipAddress);
            BaseEnv.SetStorage("DevicePort", port);
            DialogResult = true;
            this.Close();
        }
    }
}
